//
//  NetworkManager.h
//  MapLink
//
//  Created by Power User on 5/28/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
@class GroupEntity;
@class UserLocationEntity;
@class NotificationEntity;


@interface NetworkManager : NSObject {
	NSMutableData *buffer;
	NSURLConnection *conn;
	
	NSString *serverString;
}

@property (nonatomic, retain) NSMutableData *buffer;
@property (nonatomic, retain) NSString *serverString;

- (id) initWithServerString:(NSString *)str;

+ (BOOL) connectedToNetwork;
+ (BOOL) networkAvailable;
+ (BOOL) activeWWAN;
+ (BOOL) activeWLAN;
+ (NSString *) localWiFiIPAddress;
+ (void) pingReachabilityInternal;

- (void) processResponse:(NSMutableData *)data;

- (void) performSynchronousRequest:(NSString *)urlString;

- (void) createGroup:(GroupEntity *)group byUser:(UserLocationEntity *)user;
- (void) joinGroup:(GroupEntity *)group withUser:(UserLocationEntity *)user;
- (void) unjoinGroup:(GroupEntity *)group withUser:(UserLocationEntity *)user;
- (void) updateLocation:(UserLocationEntity *)location forGroup:(GroupEntity *)group;
- (void) updateMeetingPointForGroup:(GroupEntity *)group byUser:(UserLocationEntity *)user;
- (void) sendNotification:(NotificationEntity *)notification;
- (void) retrieveNotification:(UserLocationEntity *)user;

@end
